package com.asteroid20.service.imp1;

import com.asteroid20.Account;
import com.asteroid20.dao.imp1.LoginDao;
import com.asteroid20.md5;

import java.util.Scanner;

public class LoginServiceImp1 implements LoginService {

    private LoginDao login;
    private Account account;
    //重写构造函数 xml-constructor-arg下name为构造函数的参数 ref为bean
    public LoginServiceImp1(Account account) {
        this.account = account;
    }


    public void sign() {
        md5 md5 = new md5();
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入账号");
        String account_name = scanner.nextLine();
        System.out.println("请输入密码");
        String password = scanner.nextLine();
        password = md5.switchMD5(password);
        account.account = account_name;
        account.password = password;
        login.play(account);
        System.out.println("注册成功");
    }

    //不显示但是能用
    //.xml配置文件property下name指向setter方法名中的set后面的名字 ref为bean
    //<property name="LoginDao" ref="loginDao"/>
    //自动注入autowire
    @SuppressWarnings("all")
    public void setLoginDao(LoginDao a13) {
        this.login = a13;
    }
    @SuppressWarnings("all")
    public void setAccount(Account a14) {
        this.account = a14;
    }


}

